package com.acme.task3;

public class Task3Arrays {
	static int [] arrayInt;
	
	public static void main(String[] args) 
	{
		int n = 50;
		arrayInt = new int [n];
		for (int i = 1; i < n; i++) 
		{
			if ( i % 3 == 0 )
			{
				System.out.println(String.format("Число %d кратно трем", i));
			}
			arrayInt[i] = i;
		}	
		avg();
	}
	
	public static int sum()
	{
		int sumInt = 0;
		if (arrayInt != null)
		{
			for ( int i = 0; i < arrayInt.length; i++ )
			{
				sumInt += arrayInt[i];
			}
		}
		return sumInt;
	}
	
	public static void avg()
	{
		if ((arrayInt != null) && (arrayInt.length != 0))
		{
			System.out.println(String.format("Среднее значение = %2.2f", (double)sum()/arrayInt.length));
		}
	}
}
